package business.ebo;

import business.ebi.UserEBI;
import dao.dai.UserDao;
import dao.factory.DaoFactory;
import entity.User;

import java.sql.SQLException;

public class UserEBO implements UserEBI {

    private final UserDao ud = DaoFactory.getUserDao();

    @Override
    public boolean check(String uId, String uPwd) throws SQLException {
        User search = ud.search(uId);
        return search.getuPwd().equals(uPwd);
    }

    @Override
    public boolean check(String uId) throws SQLException {
        User user = ud.search(uId);
        return user!=null;
    }

    @Override
    public boolean insert(String uId, String uPwd) throws SQLException {
        return ud.insert(uId,uPwd);
    }

    @Override
    public boolean update(String uId, String uPwd) throws SQLException {
        return ud.update(uId,uPwd);
    }
}
